package com.example.chat.type;

import java.util.EnumSet;
import java.util.List;
import java.util.Set;

public enum ApprovalStatus {
    //审批状态
    ING(0, "待审批"),
    UNDER(1, "审批中"),
    SUCCESS(2, "已通过"),
    REJECT(3, "已驳回"),
    REVOKE(4, "已撤销"),
    ALL(5, "所有");
    public static final Set<ApprovalStatus> UNFINISH_LIST = EnumSet.of(ING, UNDER);
    public static final Set<String> UNFINISH_LIST_TEXT = Set.of("待审批", "审批中");
    public static final Set<ApprovalStatus> FINISH_LIST = EnumSet.of(SUCCESS, REJECT);
    public static final Set<ApprovalStatus> end = EnumSet.of(SUCCESS, REJECT);

    private Integer index;

    private String msg;

    private String code;

    ApprovalStatus(Integer index, String msg) {
        this.index = index;
        this.msg = msg;
    }

    /**
     * @description: 只有一级审批相关审批状态
     * @author YaXing
     * @date 2022/5/19 18:09
     */
    public static List<ApprovalStatus> getFirstStatusList() {
        return List.of(ING, SUCCESS, REJECT);
    }

    /**
     * 审批状态去掉所有
     *
     * @author: changwei
     * @date: 2022/6/30
     * @param: []
     * @return: java.util.List<com.dragonsoftbravo.doa.type.ApprovalStatus>
     */
    public static List<ApprovalStatus> getStatusRemoveAll() {
        return List.of(ING, UNDER, SUCCESS, REJECT);
    }

    public static Set<ApprovalStatus> unfinishStatus() {
        return UNFINISH_LIST;
    }

    public static Set<String> unfinishStatusByText() {
        return UNFINISH_LIST_TEXT;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public Integer getIndex() {
        return index;
    }

    public void setIndex(Integer index) {
        this.index = index;
    }
}